﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICSharpCode.SharpZipLib.Zip;
using System.IO;

namespace SplittingBigFiles
{
    class Program
    {
        static void Main(string[] args)
        {
            ZipOutputStream newZip = new ZipOutputStream(File.Create("pesho.zip"));
            using (newZip)
            {
                newZip.SetLevel(9);
                ZipEntry file = new ZipEntry("123.txt");
                newZip.PutNextEntry(file);
                using (FileStream fs = File.OpenRead("123.txt"))
                {

                    // Using a fixed size buffer here makes no noticeable difference for output
                    // but keeps a lid on memory usage.
                    byte[] buffer = new byte[4096];
                    int sourceBytes;
                    do
                    {
                        sourceBytes = fs.Read(buffer, 0, buffer.Length);
                        newZip.Write(buffer, 0, sourceBytes);
                    } while (sourceBytes > 0);
                }
            }

        }
    }
}
